home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
comm
/
bbs
/
maxsbbsus.lha
/
MAX154
/
TBM
/
Scripts
/
arc.scp
< prev
next >
Wrap
Text File
|
1995-04-25
|
5KB
|
131 lines
The following is a textfile from my BBS. At the bottom is the file I
currently use, it's a bit smarter than the one outlined here:
Okay, you've got a directory full of files, and you want to do the same
operation to each of them. Some examples might be:
> Editing a number of textfiles, then doing something to each of them after
you're through, such as renaming them or copying a duplicate to a different
directory.
> Compressing a number of files to individual LHA files.
> Converting a number of .arc, .zoo or .lzh files to the LHA format.
> Adding a ReadMe file or something to a number of LHA files, or deleting
every zzenpad.foo and display.me.
Really, any operation that you can list out as a standard Execute scriptfile,
but this will allow you to do it to a number of files, one-by-one.
Let's take an easy example. Let's say we have a bunch of pictures we want
to compress to individual LHA files. They're in our dh0:Files directory.
Smart DOS uses the List command to list out the Files directory, and the
"LFORMAT" option tells the List command to name them like wildcards. So
"<name>" is the name of the next file on the list. If we were making an
Execute scriptfile, planning on doing this to just ONE file, it would look
something like the following. This could be done better, but for this
example we'll just take it step-by-step:
MakeDir Ram:Temp ;we'll do all the work here
CD Ram:Temp
Copy dh0:Files/Pic1 Ram:Temp ;copies the file to Ram:Temp
LHA a Pic1 ;compresses the file to Pic1.lha
Copy Pic1.lha dh0:Files ;copies Pic1.lha back to hard drive
Delete #? ;deletes files in work area
Okay, with me so far? Now check out the following. To note is that the
Echo line is ONE line with your text editor, although it'll break into two
lines here if you're using a text viewer. This is the scriptfile that you
Execute:
.k dev
.def dev "Ram:" ;no, I don't know if all of this stuff is
.bra { ;necessary, just leave it in
.ket }
MakeDir Ram:Temp
CD Ram:Temp
List >Ram:x1 dh0:Files/#?.lha nohead quick LFORMAT "Execute Ram:x2 %s %s"
Echo >Ram:x2 ".k path,name*nCopy dh0:Files/<name> Ram:Temp*nLHA a <name>*nCopy <name>.lha dh0:Files*nDelete #?"
Execute Ram:x1 ;this is what actually does the work
Okay, you can kinda see what that did. It listed out the files in
dh0:Files, it kept the list "clean" with nohead and quick, and the LFORMAT
links the Echo line on each entry, with the whole mess being outputted to a
scriptfile in Ram called x1, which is then Executed.
The Echo command is ONE line, remember. It should basically be what we had
listed up above, with the little "*n" jobbies in between each command. I
guess the line can be as long as 255 characters, the max chars of a DOS line.
If you need more than that, I suppose one of your commands could be the
executing of a scriptfile which would continue things. Don't know if the
sub-scriptfile would recogninze the "<name>" wildcard or not, never tried it.
Interesting thought, though. If it follows DOS rules, it "should" work. But
we all know what "should" means in the computer world. :)
Following is an example of how to use subdirectories in all this, like if
you're compressing LHA files with subdirectories. This converted my board's
LZH files to LHA:
List >Ram:x1 dh0:Audio/#?.lzh nohead quick LFORMAT "Execute Ram:x2 %s %s"
Echo >Ram:x2 ".k path,name*nc:LHA x <path><name>*nc:LHA -erx a <name> #?*nCopy #?.lzh dh0:Audio/#?.lha*nc:Delete <path><name>*nc:Delete #? all"
The "Delete <path><name>" was really ballsy, as it was deleting my precious
board files while doing the work, but space-wise, it had to be done that way.
What you're looking at are the "<path>" commands, the "-erx" and #? options
so LHA can do its thing, and the "all" option for Delete.
Basically, once you get it going for one operation, you just keep a Master
kicking around somewhere, and when you want to do something different in the
future, just plug in the different pathnames and commands.
1.3 users, both the Arp Rename and Copy commands are needed.
*
Okay, so here's the one I commonly use when I want to archive a bunch of
files. It's `trick' is that you just use the Assign command to assign XXX:
over to whatever directory the files are in. It copies XXX:<files> to Ram,
one by one, compresses them, then copies the .lha files back to XXX:
.k dev
.def dev "Ram:"
.bra {
.ket }
cd ram:
failat 25
delete >nil: ram:temp all
failat 25
makedir ram:temp
cd ram:temp
list >Ram:x1 XXX: nohead quick lformat "execute Ram:x2 %s %s"
echo >Ram:x2 ".k path,name*ncopy XXX:<name> ram:temp*nlha a <name>*ncopy #?.LHA XXX:*ndelete #?"
execute Ram:x1
cd ram:
delete ram:x1 ram:x2 ram:temp all
Good luck!